package haemers.reflection.tests 
{
	import nl.haemers.data.reflection.IMetadatas;
	import nl.haemers.data.reflection.IParameters;
	import nl.haemers.data.reflection.Method;
	import org.flexunit.Assert;
	/**
	 * ...
	 * @author Jonathan
	 */
	public class MethodTest 
	{
		private var _nameMethod:Method;
		private var _ignoreMethod:Method;
		private var _overwriteableMethod:Method;
		
		/** Public methods **/
		[Before]
		public function setup() : void
		{
			_nameMethod = new Method(_nameXML);
			_ignoreMethod = new Method(_ignoreXML);
			_overwriteableMethod = new Method(_overwriteableXML);
		}
		
		[Test]
		public function testBasicMethod() : void
		{
			Assert.assertEquals("haemers.reflection.data.vo::MethodVO", _nameMethod.declaredBy);
			Assert.assertTrue(_nameMethod.hasSerialize());
			Assert.assertNotNull(_nameMethod.metadatas);
			Assert.assertTrue(_nameMethod.metadatas is IMetadatas);
			Assert.assertEquals("addName", _nameMethod.methodName);
			Assert.assertEquals("addName", _nameMethod.name, _nameMethod.toString());
			Assert.assertFalse(_nameMethod.overwriteable);
			Assert.assertNotNull(_nameMethod.parameters);
			Assert.assertTrue(_nameMethod.parameters is IParameters);
			Assert.assertEquals("void", _nameMethod.returnType);
		}
		
		[Test]
		public function testIgnoreMethod() : void
		{
			Assert.assertTrue(_ignoreMethod.ignore);
		}
		
		[Test]
		public function testOverwriteableMethod() : void
		{
			Assert.assertTrue(_overwriteableMethod.overwriteable);
		}
		
		[After]
		public function teardown() : void
		{
			_nameMethod = null;
			_ignoreMethod = null;
			
			_nameXML = null;
			_ignoreXML = null;
		}
		/** Getters & Setters **/
		
		/** Protected methods **/
		
		/** Private methods **/
		private var _nameXML:XML = new XML(
			<method name="addName" declaredBy="haemers.reflection.data.vo::MethodVO" returnType="void">
				<parameter index="1" type="Number" optional="false"/>
				<parameter index="2" type="String" optional="false"/>
				<metadata name="Serialize">
				  <arg key="params" value="id,name"/>
				</metadata>
				<metadata name="__go_to_definition_help">
				  <arg key="pos" value="482"/>
				</metadata>
			</method>
		);
		private var _ignoreXML:XML = new XML(
			<method name="ignoreMe" declaredBy="haemers.reflection.data.vo::MethodVO" returnType="void">
				<parameter index="1" type="Boolean" optional="false"/>
				<metadata name="Serialize">
				  <arg key="params" value="ignoreme"/>
				  <arg key="ignore" value="true"/>
				</metadata>
				<metadata name="__go_to_definition_help">
				  <arg key="pos" value="1002"/>
				</metadata>
			</method>
		);
		private var _overwriteableXML:XML = new XML(
			<method name="overwriteme" declaredBy="haemers.reflection.data.vo::MethodVO" returnType="void">
				<parameter index="1" type="String" optional="false"/>
				<metadata name="Serialize">
				  <arg key="params" value="overwriteme"/>
				  <arg key="overwriteable" value="true"/>
				</metadata>
				<metadata name="__go_to_definition_help">
				  <arg key="pos" value="1155"/>
				</metadata>
			</method>
		);
	}
/*	
	<type name="haemers.reflection.data.vo::MethodVO" base="Object" isDynamic="false" isFinal="false" isStatic="false">
  <extendsClass type="Object"/>
  <method name="addCollection" declaredBy="haemers.reflection.data.vo::MethodVO" returnType="void">
    <parameter index="1" type="Array" optional="false"/>
    <metadata name="Serialize">
      <arg key="name" value="addNameCollection"/>
      <arg key="params" value="collection"/>
    </metadata>
    <metadata name="__go_to_definition_help">
      <arg key="pos" value="650"/>
    </metadata>
  </method>
  <method name="overwriteme" declaredBy="haemers.reflection.data.vo::MethodVO" returnType="void">
    <parameter index="1" type="String" optional="false"/>
    <metadata name="Serialize">
      <arg key="params" value="overwriteme"/>
      <arg key="overwriteable" value="true"/>
    </metadata>
    <metadata name="__go_to_definition_help">
      <arg key="pos" value="1155"/>
    </metadata>
  </method>
  <method name="addDifferentParamNames" declaredBy="haemers.reflection.data.vo::MethodVO" returnType="void">
    <parameter index="1" type="String" optional="false"/>
    <parameter index="2" type="String" optional="false"/>
    <metadata name="Serialize">
      <arg key="params" value="secondname,thirdname"/>
    </metadata>
    <metadata name="__go_to_definition_help">
      <arg key="pos" value="796"/>
    </metadata>
  </method>
 
  <metadata name="__go_to_ctor_definition_help">
    <arg key="pos" value="375"/>
  </metadata>
  <metadata name="__go_to_definition_help">
    <arg key="pos" value="97"/>
  </metadata>
</type>
*/

}